<script setup>
import { baseagree } from "@/services/user";
import { onLoad, onShow } from "@dcloudio/uni-app";
import { nextTick, ref, watch, onMounted } from "vue";
import { formatPrice } from "@/utils/formatPrice";
import { earnCount, skip, productnumber, mine } from "@/services/user";

onShow(() => {
  minefun();
});

const balance = ref({});

async function minefun() {
  let res = await mine();
  balance.value = res.data;
}

const godetlist = () => {
  uni.navigateTo({
    url: "/pages/servicereward/myreward/rewardlist",
  });
};

const gobalanceindex = () => {
  uni.navigateTo({
    url: "/pages/servicereward/myreward/index",
  });
};

const gobalance = () => {
  uni.navigateTo({
    url: "/pages/servicereward/myreward/balance",
  });
};

const goygfun = () => {
  uni.navigateTo({
    url: "/pages/servicereward/myreward/rewardyg",
  });
};
</script>

<template>
  <view class="content">
    <view class="work-banner">
      <view class="foodr-list">
        <view class="list-index">
          <view class="list-index-left">账户余额</view>
          <view class="list-index-right" @click="godetlist"
            >余额变动明细
            <image
              src="@/static/team/shopkeeper/icon-gm11.png"
              mode="widthFix"
            ></image>
          </view>
        </view>
      </view>

      <u-line></u-line>
      <view class="work-middle">
        <view class="work-middle-left">
          <view class="middle-left-top">账户余额（元）</view>
          <view class="middle-left-footer" @click="gobalanceindex"
            >￥{{ formatPrice(balance.balance || 0) }}</view
          >
        </view>
        <view class="work-middle-right">
          <!-- <view class="middle-right-bt" @click="gopayment">代付</view> -->
          <view class="middle-right-bt withdrawal" @click="gobalance"
            >提现</view
          >
        </view>
      </view>
      <u-line></u-line>

      <view class="work-banner-footer">
        <view class="work-footer-box">
          <view class="left-box">
            <view class="work-left-text">预估收入</view>
            <view class="work-middle-img">
              <uni-tooltip
                class="item"
                content="未出账的预估收益"
                placement="right"
              >
                <view class="item">
                  <u-icon name="question-circle"></u-icon
                ></view>
              </uni-tooltip>
            </view>
            <view class="work-money" @click="goygfun"
              >￥{{ formatPrice(balance.expected_reward || 0) }}

              <text v-if="balance.select" class="work-money-to"></text>
            </view>
          </view>
        </view>
        <view class="work-footer-box">
          <view class="left-box">
            <view class="work-left-text">提现中</view>
            <view class="work-money"
              >￥{{ formatPrice(balance.settle_balance || 0) }}</view
            >
          </view>
        </view>
      </view>
    </view>
  </view>
</template>

<style lang="scss" scoped>
@import "./myMoney.scss";
</style>
